import java.util.*;
public class Lab09Task03 {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int n;
do {
System.out.print("Enter the size: ");
n=kb.nextInt();
}while(n<=0);
int[] arr= new int[n];
System.out.print("The array is initialized with values: ");
for(int i=0;i<arr.length;i++) {
arr[i]=(int)(Math.random()*30)+1;
System.out.print(arr[i]+" ");
}
System.out.print("\nEnter the value to search for: ");
int value=kb.nextInt(),index=-1;
for(int i=0;i<arr.length;i++) {
if(arr[i]==value) {
index=i;
break;
}
}
if(index>=0)
System.out.printf("%nThe value %d is present in the array, its first index is %d",value,index);
else
System.out.printf("%nThe value %d is not present in the array",value);
kb.close();
}
}